package com.wxg.SpringActiveMQ.mq.consumer.topic;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;

import org.springframework.stereotype.Component;

@Component()
public class TopicReceiver2 implements MessageListener {

	@Override
	public void onMessage(Message message) {
		TextMessage textMsg = (TextMessage)message;
		if(null != textMsg){
			try {
				System.out.println( String.format("TopicReceiver2接收到消息：%s", textMsg.getText()) );
			} catch (JMSException e) {
				e.printStackTrace();
			}
		}
	}

}
